package frontend.pages.reports.entirework;

import backend.model.worklog.WorkLog;
import backend.service.worklog.WorkLogService;
import frontend.core.TimeTrackingWebApplication;
import frontend.model.reports.ReportInputUIModel;
import frontend.pages.reports.base.AbstractReportForm;
import org.apache.wicket.markup.html.WebMarkupContainer;

import java.util.List;

public class EntireWorkReportForm extends AbstractReportForm<WorkLog> {
    public EntireWorkReportForm(String id, ReportInputUIModel model, List<WorkLog> reportResults, WebMarkupContainer workLogListContainer) {
        super(id, model, reportResults, workLogListContainer);
    }

    @Override
    protected void addAdditionalFilteringComponents() {
        // no other components
    }

    protected List<WorkLog> retrieveReportDataFromDatabase() {
        WorkLogService workLogService = TimeTrackingWebApplication.getService(WorkLogService.class);
        return workLogService.loadWorkLogForTimeInterval(uiModel.getStartDate(), uiModel.getEndDate());
    }
}
